﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace yq.WebModel.Sys
{
    /// <summary>
    /// 团队成员列表
    /// </summary>
    public class TeamUserListPage : yq.WebModel.ListPage<yq.WebModel.Sys.TeamUserList>
    {
        string _TeamId;

        public string TeamId
        {
            get { return _TeamId; }
            set { _TeamId = value; }
        }
    }

    public class TeamUserList : yq.Model.Logic.TeamUser
    {
        string _Name;

        /// <summary>
        /// 团队人员名称
        /// </summary>
        public string Name
        {
            get
            {
                if (string.IsNullOrEmpty(_Name))
                {
                    _Name = yq.Model.Logic.UserAccount.Load(this.UserId).NickName;
                }
                return _Name;
            }
        }

        yq.Enums.BooleanType _IsAdmin = Enums.BooleanType.UnKnow;

        /// <summary>
        ///是否管理员
        /// </summary>
        public bool IsAdmin
        {
            get
            {
                if (_IsAdmin== Enums.BooleanType.UnKnow)
                {
                    if (yq.Model.Logic.TeamList.Load(this.TeamId).AdminId == this.UserId)
                    {
                        _IsAdmin = Enums.BooleanType.Yes;
                    }
                    else
                    {
                        _IsAdmin = Enums.BooleanType.No;
                    }

                }

                return _IsAdmin== Enums.BooleanType.Yes;
            }
        }

    }
}
